import axios from 'axios'

// 创建axios实例  名为httpInstance
const httpInstance = axios.create({
  baseURL: 'http://pcapi-xiaotuxian-front-devtest.itheima.net',
  timeout: 5000
})

//如果项目里面有不同业务模块，需要接口基地址不同，只需要axios.create()多个示例，然后进行暴露出去，就能完成对多个地址请求

// axios请求拦截器
httpInstance.interceptors.request.use(config => {
  return config
}, e => Promise.reject(e))

// axios响应式拦截器
httpInstance.interceptors.response.use(res => res.data, e => {
  return Promise.reject(e)
})


//将httpInstance 进行导出
export default httpInstance